package com.company.sendemo.basics.zzInterview.select;

import java.util.HashMap;
import java.util.Hashtable;

public class Twelve {
    public static void main(String[] args) {
        //HashMap key value 都可以为null
        //key 不允许重复 value可重复
        //底层为哈希表 线程不安全
        HashMap<Object, Object> HashMap = new HashMap<>();
        HashMap.put("森",null);
        HashMap.put("好","成长");
        HashMap.put("好","你");
        HashMap.put("强","你");
        HashMap.put(null,"你");
        HashMap.put("量","森仔");
        System.out.println(HashMap.size());
        System.out.println(HashMap);

        //Hashtable key value 都不可以为null
        //key 不允许重复 value可重复
        Hashtable<Object, Object> Hashtable = new Hashtable<>();
        Hashtable.put("森","null");
        Hashtable.put("好","成长");
        Hashtable.put("好","你");
        Hashtable.put("刘","null");
        try {
            Hashtable.put("森",null);
            Hashtable.put(null,"仔");
        }catch (Exception e){
        }

        System.out.println(Hashtable.size());
        System.out.println(Hashtable);

    }

}
